import type { Metadata } from 'next';
import Link from 'next/link';
import { auth } from '@/auth';
import { SignOut } from '@/components/login/signout-button';

export const metadata: Metadata = {
    title: '镜像下载',
    description: 'rpa设计器镜像下载',
};

// export const revalidate = 0;
// export const dynamic = 'force-dynamic';

export default async function Layout({
    children,
}: Readonly<{
    children: React.ReactNode;
    params: { slug?: string[] };
}>) {
    const session = await auth();

    return (
        <main>
            <div className='flex justify-end px-4 mt-4 gap-2'>
                {!session?.user?.id ? (
                    <Link href='/login'>登录</Link>
                ) : (
                    <>
                        {session?.user?.name}
                        <SignOut />
                    </>
                )}
            </div>
            {children}
        </main>
    );
}
